package my.poemhelper;

import my.poemhelper.bo.IdiomBo;
import my.poemhelper.bo.PoemBo;
import my.poemhelper.bo.UserBo;
import my.poemhelper.bo.WordsBo;
import my.poemhelper.vo.Idiom;
import my.poemhelper.vo.PageControl;
import my.poemhelper.vo.Poem;
import my.poemhelper.vo.PoemAnaly;
import my.poemhelper.vo.PoemCheck;
import my.poemhelper.vo.User;
import my.poemhelper.vo.Words;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Facade implements IdiomBo,PoemBo,UserBo,WordsBo{

	public static ApplicationContext context  = new ClassPathXmlApplicationContext("applicationContext.xml");
	
	@Autowired
	public PoemBo pemBo;
	
	@Autowired
	public UserBo userBo;
	@Autowired
	private IdiomBo idiomBo;
	
	@Autowired
	private WordsBo wordsBo;
	public static Facade facade = (Facade) context.getBean("facade");


	@Override
	public User getUser(String userName,String password) {
		return userBo.getUser(userName,password);
	}


	@Override
	public void insertPeom(Poem p) {
		pemBo.insertPeom(p);
	}


	@Override
	public void delPeom(long id) {
		pemBo.delPeom(id);
	}



	@Override
	public void insertIdiom(Idiom idiom) {
		idiomBo.insertIdiom(idiom);
		
	}


	@Override
	public void queryIdiom(String idiom, PageControl<Idiom> pageControl) {
		idiomBo.queryIdiom(idiom, pageControl);
	}


	@Override
	public void delIdiom(long id) {
		idiomBo.delIdiom(id);
		
	}


	@Override
	public void queryPoemByWord(String w, PageControl<Poem> pc) {
		pemBo.queryPoemByWord(w, pc);
	}


	@Override
	public void doPoemAnaly(PoemAnaly pa) {
		pemBo.doPoemAnaly(pa);
	}


	@Override
	public void doPoemCheck(PoemCheck pc) {
		pemBo.doPoemCheck(pc);
	}


	@Override
	public void insertWords(Words w) {
		wordsBo.insertWords(w);
	}


	@Override
	public int getWordsCount() {
		return wordsBo.getWordsCount();
	}
}
